<?php

$api = app('Dingo\Api\Routing\Router');
$moduleName = 'Topic';

// 平台后台api
$api->version('v1', ['prefix' => 'admin-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Admin\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'] ;

	$api->resource('topics', "TopicController", ['only' => $allMethod]);
	$api->resource('topic-tags', "TopicTagController", ['only' => $allMethod]);
	$api->resource('topic-groups', "TopicGroupController", ['only' => $allMethod]);
});

// 租户api
$api->version('v1', ['prefix' => 'tenant-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Tenant\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];
});

// 普通用户api
$api->version('v1', ['namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Client\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];

	$api->get('/topics', ['uses'=> "TopicController@index"]);
	$api->post('/topics', ['uses'=> "TopicController@store"]);
	$api->post('/topics/{uuid}/actions', ['uses'=> "TopicController@action"]);

	$api->get('/topics/{uuid}/comments', ['uses'=> "CommentController@index"]);
	$api->post('/topic/comments', ['uses'=> "CommentController@store"]);

	$api->get('/topics/{uuid}', ['uses'=> "TopicController@show"]);

	$api->get('/topic-tags', ['uses'=> "TopicTagController@index"]);
	$api->get('/topic-groups', ['uses'=> "TopicGroupController@index"]);
});